package com.example.blew.omp.system.controller;


import com.example.blew.omp.system.model.ReturnModel;
import com.example.blew.omp.system.model.form.UserForm;
import com.example.blew.omp.system.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("user")
public class UserController {

    @Resource
    private UserService userService;

    @Operation(summary = "用户保存", description = "用户保存")
    @PostMapping(value = "save")
    public ReturnModel save(@RequestBody UserForm userForm){
        Boolean save = userService.save(userForm);
        return ReturnModel.newSuccessInstance(save);
    }

    @Operation(summary = "用户保存", description = "用户保存")
    @PostMapping(value = "login")
    public ReturnModel login(@RequestBody UserForm userForm){
        ReturnModel login = userService.login(userForm);
        return login;
    }
}
